<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>简单工厂模式</title>
	</head>
	<body>
		<script>
			function User(name , age, career, work) {
			    this.name = name
			    this.age = age
			    this.career = career 
			    this.work = work
			}
			
			function Factory(name, age, career) {
			    let work;
			    switch(career) {
			        case 'coder':
			            work =  ['写代码','写系分', '修Bug'] 
			            break
			        case 'product manager':
			            work = ['订会议室', '写PRD', '催更']
			            break
			        case 'boss':
			            work = ['喝茶', '看报', '见客户']
			       }
			    return new User(name, age, career, work);
			}
			const user = Factory("张三", 18,'coder');
			const user1 = Factory("李四", 20,'product manager');
			console.log(user)
			console.log(user1)
		</script>
	</body>
</html>
